#include "CAnimation.h"

CAnimation::CAnimation()
{
	m_fAnimationTimer = 0.00f;
	m_bReverse = false;
}

void CAnimation::NextFrame()
{
	if(m_nCurrentFrame == m_vFrames.size() -1)
	{
		switch(m_nAnimationStyle)
		{
		case 0:
			{
				return;
			}
		case 1:
			{
				m_nCurrentFrame = 0;
				break;
			}
		case 2:
			{
				m_nCurrentFrame--;
				m_bReverse = true;
				break;
			}
		}
		return;
	}

	if(m_nCurrentFrame < m_vFrames.size()-1 && m_bReverse == false)
	{
		m_nCurrentFrame++;
	}

	if(m_bReverse)
	{
		if(m_nCurrentFrame == 0)
		{
			m_bReverse = false;
		}

		if(m_nCurrentFrame > 0)
		{
			m_nCurrentFrame--;
		}
	}

}
void CAnimation::Stop()
{
	m_bIsActive = false;
	m_nCurrentFrame = 0;
}
void CAnimation::Pause()
{
	m_bIsActive = false;
}
void CAnimation::Play()
{
	m_bIsActive = true;
}